/**
 * 
 */
package com.teach.servlet.admin;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.teach.entity.User;
import com.teach.service.UserLookService;
import com.teach.service.impl.UserLookServiceImpl;

/**
 * @author Liulianqiu
 *2020年8月1日
 */
public class UserLookServlet extends HttpServlet{

	UserLookService userLookService = new UserLookServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Integer value = null;
		try {
		     value = Integer.valueOf(request.getParameter("userId"));
		} catch (NumberFormatException e) {
			throw new ServletException("参数错误", e);
		}
		User user = userLookService.look(value);
		request.setAttribute("user", user);
		request.getRequestDispatcher("/admin/message.jsp").forward(request, response);
	}
}
